<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>
<?
/*
	$sql = "SELECT * FROM assessment_standard INNER JOIN assessment on assessment_standard.aid = assessment.id WHERE year != 2555";
	$rss = $db->query($sql);
	while($line = $db->fetchNextObject($rss)){
		$sql = "DELETE FROM assessment_standard WHERE aid = $line->aid";
		$db->query($sql);
	}
	$sql = "DELETE FROM common WHERE year != 2555";
	$db->query($sql);

	$sql = "DELETE FROM staff WHERE year != 2555";
	$db->query($sql);

	$sql = "SELECT * FROM staff WHERE year = 2555";
	$rss = $db->query($sql);
	while($line = $db->fetchNextObject($rss)){
		$sql = "INSERT INTO staff(name, position, picture, page, year) VALUES ('$line->name', '$line->position', '$line->picture', '$line->page', 2554)";
		$db->execute($sql);
	}

	$sql = "SELECT * FROM assessment WHERE year = 2555";
	$rss = $db->query($sql);
	while($line = $db->fetchNextObject($rss)){
		$sql = "INSERT INTO assessment(gid ,sub ,year ,name ,type ,principle ,related ,evaluation ,result ,target ,indicator ,collector ,project ,p0 ,p1 ,p2 ,p3 ,p4 ,p5 ,ext_evaluation ,ext_comment ,ext_user ,formula_text ,percent ,unit ,common1 ,common2 ,result1 ,result2) VALUES ( '$line->gid','$line->sub',2554,'$line->name','$line->type','$line->principle','$line->related','$line->evaluation','$line->result','$line->target','$line->indicator','$line->collector','$line->project','$line->p0','$line->p1','$line->p2','$line->p3','$line->p4','$line->p5','$line->ext_evaluation','$line->ext_comment','$line->ext_user','$line->formula_text','$line->percent','$line->unit','$line->common1','$line->common2','$line->result1','$line->result2')";
		$db->execute($sql);
	}

	$sql = "DELETE FROM assessment WHERE year != 2555";
	$db->query($sql);

	$sql = "SELECT * FROM assessment WHERE year = 2555";
	$rss = $db->query($sql);
	while($line = $db->fetchNextObject($rss)){
		$sql = "INSERT INTO assessment(gid ,sub ,year ,name ,type ,principle ,related ,evaluation ,result ,target ,indicator ,collector ,project ,p0 ,p1 ,p2 ,p3 ,p4 ,p5 ,ext_evaluation ,ext_comment ,ext_user ,formula_text ,percent ,unit ,common1 ,common2 ,result1 ,result2) VALUES ( '$line->gid','$line->sub',2554,'$line->name','$line->type','$line->principle','$line->related','$line->evaluation','$line->result','$line->target','$line->indicator','$line->collector','$line->project','$line->p0','$line->p1','$line->p2','$line->p3','$line->p4','$line->p5','$line->ext_evaluation','$line->ext_comment','$line->ext_user','$line->formula_text','$line->percent','$line->unit','$line->common1','$line->common2','$line->result1','$line->result2')";
		$db->execute($sql);
		$id = $db->lastInsertedId();

		$sql = "SELECT * FROM assessment INNER JOIN assessment_standard on assessment.id = assessment_standard.aid WHERE assessment.id = $line->id";
		$rss2 = $db->query($sql);
		while($line2 = $db->fetchNextObject($rss2)){
			$sql = "INSERT INTO assessment_standard(aid,name,result) VALUES('$id','$line2->name','$line2->result')";
			$db->execute($sql);
		}
	}
*/
/*
	$sql = "SELECT * FROM common WHERE year = 2555";
	$rss = $db->query($sql);
	while($line = $db->fetchNextObject($rss)){
		$sql = "INSERT INTO common(year ,gid ,name ,target ,upload ,icon) VALUES(2554,'$line->gid','$line->name','$line->target','$line->upload','$line->icon')";
		$db->execute($sql);
	}
*/

?>
</body>
</html>